package ch6;

import java.util.HashMap;
import java.util.Map;

public class UnsafeStateFullObject {
    static Map<String, String> cache = new HashMap<String, String>();

    public String doSomething(String s, int len) {
        String result = cache.get(s);
        if (null == result) {
            result = md5sum(result, len);
            cache.put(s, result);
        }
        return result;
    }

    public String md5sum(String s, int len) {
        // 生成md5摘要
        return s;
    }
}
